package com.haohan.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.haohan.domain.ServerInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface ServerInfoDao extends BaseMapper<ServerInfo> {

//    @Select("select * from instance_info where id = #{id}")
//    Instance getById(Integer id);
    // 批量保存数据
    @Insert("<script>" +
        "INSERT INTO server_info (server_ip,username,password,rack,department,architecture,os,status," +
        "run_time,bmc_ip,bmc_user,bmc_pass,remark) VALUES " +
        "<foreach collection='list' item='item' separator=','>" +
        "(#{item.serverIp},#{item.username},#{item.password},#{item.rack},#{item.department}," +
        "#{item.architecture},#{item.os},#{item.status},#{item.runTime},#{item.bmcIp}," +
        " #{item.bmcUser},#{item.bmcPass},#{item.remark})" +
        "</foreach>" +
        "</script>")
    int saveBatch(List<ServerInfo> list);
}
